package com.aaa.javaweb.servlet;

import com.aaa.javaweb.dao.UserDao;
import com.aaa.javaweb.entity.User;
import com.aaa.javaweb.until.TableLabe;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
public class UserController {

   @Autowired
    private UserDao userDao;

    @RequestMapping("seluser")
    @ResponseBody
    public TableLabe seluser(){
        List<Map> maps = userDao.selALL();
        TableLabe tableLabe = new TableLabe(0,"",maps.size(),maps);
        return tableLabe;
    }

    @RequestMapping("upduser")
    @ResponseBody
    public int upduser(User user){
        int updone= userDao.updone(user);
        return updone;
    }
}
